<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script src="../js/jquery-3.3.1.min.js"></script>

    <script>
        function upload() {
            var formData = new FormData($("#uploadForm")[0])  //创建一个forData
            formData.append('img', $('#pic_img')[0].files[0]) //把file添加进去  name命名为img

            $.ajax({
                url: "registerControll.php",
                data: formData,
                type: "POST",
                async: false,
                cache: false,
                contentType: false,
                processData: false,
                success: function (data) {
                    //成功
                    alert(data)
                },
                error: function () {
                    //失败
                }
            })
        }


    </script>
</head>
<body>


<img src="" alt="" class="backimg">

<form enctype="multipart/form-data" id="uploadForm">
    <input type='file' name='xxx' id='pic_img'>
    <input type='button' onclick='upload()' value='点击上传'>
</form>


</body>
</html>